""" System imports """
import os,sys
import logging

""" Other modules """
import pygame

""" Game """
#import resourcemanager

""" Constants """

""" Set up logging """
widget_logger = logging.getLogger("epicquest.widget")
widget_logger.debug("Initializing Widget")

"""
"""
class Widget():
        
    """
    All params are keyword args. If you don't set one, it will choose a default.
    @param pos: Position of the widget (x, y)
    @param size: Size of the widget (width, height) 
    @param border: Whether or not to draw a border
    @param border_color: Color of the border, as tuplet
    @param border_width: Width of the border
    @param background: Whether or not to draw the background
    @param background_color: Color of the background 
    """
    def __init__(self, *args, **kwargs):
        self.rect = pygame.rect.Rect(kwargs.get('pos', (10,10)),
                                     kwargs.get('size', (60, 15)))
        self.border = kwargs.get("border", True)
        self.border_color = kwargs.get("border_color", (100,255,100))
        self.border_width = kwargs.get("border_width", 1)
        self.background = kwargs.get("background", True)
        self.background_color = kwargs.get("background_color", (200,200,255))
        self.surface = pygame.surface.Surface(self.rect.size)
        self.dirty = 1
        
    def resize(self, size):
        self.rect.size = size
        self.dirty = 1
        
    def move(self, loc):
        self.rect.topleft = loc
        
    def update(self):
        if self.dirty == 0:
            return
        if self.background:
            self.surface.fill(self.background_color)
        if self.border:
            pygame.draw.rect(self.surface,self.border_color, self.surface.get_rect(), self.border_width)
        self.dirty = 0
                
    def draw(self, surface):
        surface.blit(self.surface, self.rect)
        
    
    